package com.dragon.app.concurrent;

/**
 * 
 * <p>class: PossibleReordering</p>  
 * <p>Description: </p>  
 * @author SmallDragon
 * @date 2019年5月6日
 *
 */
public class PossibleReordering {
	static int x = 0;
	static int y = 0;
	static int a = 0;
	static int b = 0;

	public static void main(String[] args) throws InterruptedException {
		Thread one = new Thread(new Runnable() {
			public void run() {
				a = 1;
				x = b;
			}
		});

		Thread other = new Thread(new Runnable() {
			public void run() {
				b = 1;
				y = a;
			}
		});
		one.start();
		other.start();
		one.join();
		other.join();
		System.out.println("(" + x + "," + y + ")");
	}
}